use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ColumnInfo {
    pub name: String,
    pub r#type: String,
    pub nullable: bool,
    pub default_value: String,
    pub comment: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ForeignKeyInfo {
    pub column_name: String,
    pub reference_table: String,
    pub reference_column: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TableInfo {
    pub table_name: String,
    pub columns: Vec<ColumnInfo>,
    pub primary_keys: Vec<String>,
    pub foreign_keys: Vec<ForeignKeyInfo>,
    pub comment: String,
}

impl TableInfo {
    pub fn new(table_name: String) -> Self {
        TableInfo {
            table_name,
            columns: vec![],
            primary_keys: vec![],
            foreign_keys: vec![],
            comment: "".to_string(),
        }
    }
}
